var a = require("../../@babel/runtime/helpers/toConsumableArray"), t = getApp();

Page({
    data: {
        member: {},
        total: "",
        recordsList: [],
        inputs: "",
        isLoadMore: !0,
        total_page: 0,
        page: 1
    },
    onLoad: function(a) {
        this.getRecordList();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.isLoadMore ? this._getMoreData() : console.log("没有更多数据");
    },
    onShareAppMessage: function() {},
    enterSearch: function() {
        this.data.isLoadMore = !0, this.data.total_page = 0, this.data.page = 1, this.getRecordList();
    },
    getRecordList: function() {
        var a = this, e = this, s = t.getNetAddresss("plugin.commission-statistics.api.index.index");
        t._postNetWork({
            url: s,
            data: {
                page: 1,
                keyword: this.data.inputs
            },
            success: function(t) {
                var s = t.data;
                1 == s.result && (a.data.total_page = s.data.agent.last_page, s.data.agent.current_page >= s.data.agent.last_page && e.setData({
                    isLoadMore: !1
                }), a.data.inputs || a.setData({
                    total: s.data.agent.total
                }), console.log("666666", s.data.agent.data), a.setData({
                    member: s.data.member,
                    recordsList: s.data.agent.data
                }));
            },
            fail: function(a) {
                console.log(a.msg);
            }
        });
    },
    _getMoreData: function() {
        var e = this;
        if (!(this.data.page >= this.data.total_page)) {
            var s = t.getNetAddresss("plugin.commission-statistics.api.index.index");
            this.data.page++, t._postNetWork({
                url: s,
                data: {
                    page: this.data.page,
                    keyword: this.data.inputs
                },
                success: function(t) {
                    var s = t.data;
                    if (1 == s.result) {
                        s.data.agent.current_page >= s.data.agent.last_page && (e.data.isLoadMore = !1);
                        var o = e.data.recordsList;
                        o.push.apply(o, a(s.data.agent.data)), e.setData({
                            recordsList: o
                        });
                    } else e.data.isLoadMore = !1;
                },
                fail: function(a) {
                    console.log(a.msg);
                }
            });
        }
    }
});